package adapters;

import java.util.ArrayList;

import model.ImageItem;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;

public class GalleryImageAdapter extends BaseAdapter
{
	private Context _context;
	private ArrayList<ImageItem> _imageList;
	//private ImageView _imgView;
	
	public GalleryImageAdapter(Context context, ArrayList<ImageItem> imageList) 
	{
		this._context=context;
		this._imageList=imageList;
		//this._imgView=imgView;
	}
	
	public int getCount() {
		// TODO Auto-generated method stub
		return _imageList.size();
	}

	public Object getItem(int arg0) {
		// TODO Auto-generated method stub
		return this._imageList.get(arg0).get_image();
	}

	public long getItemId(int arg0) {
		// TODO Auto-generated method stub
		return this._imageList.get(arg0).get_iD();
	}

	public View getView(int arg0, View arg1, ViewGroup arg2) 
	{
		ImageView _imgView=new ImageView(_context);
		_imgView.setImageBitmap(_imageList.get(arg0).get_image());
		_imgView.setAdjustViewBounds(true);
		//_imgView.setScaleType(ImageView.ScaleType.FIT_XY);
		//_imgView.setLayoutParams(new Gallery.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
		return _imgView;
		
	}

}
